home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC]
/
NeXTSTEP 3.3 Dev Intel.iso
/
NextDeveloper
/
Headers
/
ansi
/
sparc
/
math.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-09-14
|
4KB
|
109 lines
/* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
*
* File: <ansi/sparc/math.h>
*/
/*
* Constants.
*/
//#define HUGE_VAL (__infinity()) /* Produces IEEE Infinity. */
#define HUGE_VAL (1e999)
#ifndef __STRICT_ANSI__
//#define HUGE (infinity()) /* For historical compatibility. */
#define HUGE HUGE_VAL
#define NAN (HUGE/HUGE) /*FIXME: not in sun sources */
/* These values work with any binary representation of integers
* where the high-order bit contains the sign. */
/* a number used normally for size of a shift */
#define BITSPERBYTE 8
#define BITS(type) (BITSPERBYTE * (int)sizeof(type))
/* short, regular and long ints with only the high-order bit turned on */
#define HIBITS ((short)(1 << BITS(short) - 1))
#define HIBITI (1 << BITS(int) - 1)
#define HIBITL (1L << BITS(long) - 1)
/* largest short, regular and long int */
#define MAXSHORT ((short)~HIBITS)
#define MAXINT (~HIBITI)
#define MAXLONG (~HIBITL)
#define MAXCHAR ((char)0x7f) /*FIXME: not in sun sources */
#define MINCHAR ((char)0x80) /*FIXME: not in sun sources */
#define MINSHORT ((short)0x8000) /*FIXME: not in sun sources */
#define MININT ((int)0x80000000) /* max negative 32-bit integer */ /*FIXME: not in sun sources */
#define MINLONG ((long)0x80000000) /*FIXME: not in sun sources */
/* various values that describe the binary floating-point representation
* _EXPBASE - the exponent base
* DMAXEXP - the maximum exponent of a double (as returned by frexp())
* FMAXEXP - the maximum exponent of a float (as returned by frexp())
* DMINEXP - the minimum exponent of a double (as returned by frexp())
* FMINEXP - the minimum exponent of a float (as returned by frexp())
* MAXDOUBLE - the largest double
((_EXPBASE ** DMAXEXP) * (1 - (_EXPBASE ** -DSIGNIF)))
* MAXFLOAT - the largest float
((_EXPBASE ** FMAXEXP) * (1 - (_EXPBASE ** -FSIGNIF)))
* MINDOUBLE - the smallest double (_EXPBASE ** (DMINEXP - 1))
* MINFLOAT - the smallest float (_EXPBASE ** (FMINEXP - 1))
* DSIGNIF - the number of significant bits in a double
* FSIGNIF - the number of significant bits in a float
* DMAXPOWTWO - the largest power of two exactly representable as a double
* FMAXPOWTWO - the largest power of two exactly representable as a float
* _IEEE - 1 if IEEE standard representation is used
* _DEXPLEN - the number of bits for the exponent of a double
* _FEXPLEN - the number of bits for the exponent of a float
* _HIDDENBIT - 1 if high-significance bit of mantissa is implicit
* LN_MAXDOUBLE - the natural log of the largest double -- log(MAXDOUBLE)
* LN_MINDOUBLE - the natural log of the smallest double -- log(MINDOUBLE)
* LN_MAXFLOAT - the natural log of the largest float
* LN_MINFLOAT - the natural log of the smallest float
*/
#define MAXDOUBLE 1.797693134862315708e+308
#define MAXFLOAT ((float)3.40282346638528860e+38)
#define MINDOUBLE 4.94065645841246544e-324
#define MINFLOAT ((float)1.40129846432481707e-45)
#define _IEEE 1
#define _DEXPLEN 11
#define _HIDDENBIT 1
#define DMINEXP (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3))
#define FMINEXP (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3))
#define LN_MAXFLOAT 8.8722839052068e+01
#define LN_MINFLOAT -1.03278929903432e+02
#define _LENBASE 1
#define _EXPBASE (1 << _LENBASE)
#define _FEXPLEN 8
#define DSIGNIF (BITS(double) - _DEXPLEN + _HIDDENBIT - 1)
#define FSIGNIF (BITS(float) - _FEXPLEN + _HIDDENBIT - 1)
#define DMAXPOWTWO ((double)(1L << BITS(long) - 2) * \
(1L << DSIGNIF - BITS(long) + 1))
#define FMAXPOWTWO ((float)(1L << FSIGNIF - 1))
#define DMAXEXP ((1 << _DEXPLEN - 1) - 1 + _IEEE)
#define FMAXEXP ((1 << _FEXPLEN - 1) - 1 + _IEEE)
#define LN_MAXDOUBLE (M_LN2 * DMAXEXP)
#define LN_MINDOUBLE (M_LN2 * (DMINEXP - 1))
#define M_LN2 0.69314718055994530942
#define M_PI 3.14159265358979323846
#define M_SQRT2 1.41421356237309504880
#define M_E 2.7182818284590452354
#define M_LOG2E 1.4426950408889634074
#define M_LOG10E 0.43429448190325182765
#define M_LN10 2.30258509299404568402
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.78539816339744830962
#define M_1_PI 0.31830988618379067154
#define M_2_PI 0.63661977236758134308
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT1_2 0.70710678118654752440
#endif /* __STRICT_ANSI__ */